import pandas as pd

res = []

A = pd.read_csv('data/sale_index.csv', index_col=0, header=0)
B = pd.read_csv('data/sales_prophet.csv', index_col=0, header=0)

colnames = ['201801', '201802', '201803', '201804']
res = B.loc[:, colnames].values
res_col = pd.Series(res.flatten('F')).apply(lambda x: 0 if x<0 else x).round().astype(int)

ind = A.iloc[:, 2:].values
ind_col = ind.flatten('F')

df = pd.DataFrame({'id': ind_col, 'forecastVolum': res_col})
df.sort_values(['id'], ascending=[True], inplace=True)

df.to_csv('res/prophet.csv', header=True, index=False)